/*
 *    This file is part of CeluMap.
 *
 *    CeluMap is free software; you can redistribute it and/or modify
 *    it under the terms of the GNU Lesser General Public License as published by
 *    the Free Software Foundation; either version 3 of the License, or
 *    (at your option) any later version.
 *
 *    CeluMap is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU Lesser General Public License for more details.
 *
 *    You should have received a copy of the GNU Lesser General Public License
 *    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 *    Copyright 2006, 2007, 2008 Gonzalo Merayo
 *    gonzalo (at) celumap.com.ar
 *    www.celumap.com.ar
 *
 */

package image;


import java.io.IOException;

import javax.microedition.lcdui.Image;

import file.FileGetter;

public class ResourceImage implements GisImage {

	public final static int SUBWAYSTATION = 0;
	public final static int LETTER = 1;
	public static final int BEER = 2;
	public static final int GAS = 3;
	public static final int RESTO = 4;
	private static int[] buff = null;
	private static int width = 0;
	private static int height = 0;
	private int n = -1;
	public ResourceImage(FileGetter f, int np){
		n = np;
		if(buff == null){
			try {
				Image i =Image.createImage(f.getResource("images.png"));
				width = i.getWidth();
				height = i.getHeight();
				buff = new int[width*height];
				i.getRGB(buff, 0, width, 0, 0, width, height);
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
	}
	
	public int getWidth() {
		return 16;
	}

	public int getHeight() {
		return 16;
	}

	public int getXoff() {
		return width;
	}

	public int[] getBuff() {
		return buff;
	}

	public int getXInitOff() {
		return 16*n;
	}

	public int getYInitOff() {
		return 0;
	}

}
